<!DOCTYPE html>
<!-- saved from url=(0037)http://127.0.0.1/wx/ybss/zhuce/zc.jsp -->
<html class="pixel-ratio-1"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <title>金额设置</title>

  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no, email=no">
    <link rel="stylesheet" href="../../resource/weuimin.css" />
    <link rel="stylesheet" href="../../resource/example.css" />
    <script src="../../script/api.js"></script>
    <script src="../../resource/jquery1.js"></script>
    <script type="text/javascript" src="../../resource/wapcommon.js"></script>
    <script type="text/javascript" src="../../resource/common.js"></script>
    <link type="text/css" rel="stylesheet" href="../../resource/fapiao.css">
    <link rel="stylesheet" href="../../resource/jinsuistyle.css" />
    <script type="text/javascript" src="../../script/constants.js"></script>
    <script type="text/javascript" src="../../script/tmd5.js"></script>
    <script type="text/javascript" src="../../script/aes.js"></script>
	<script type="text/javascript" charset="UTF-8" src="../../script/naes.js"></script>
	<script type="text/javascript" src="../../script/modeecb.js"></script>

</head>
<script>



</script>
<body>
  <header>
    <div id="jsheader" style="z-index: 99;">
        <nav id="jsnav">
            <a id="jsleft" tapmode="" onclick="api.closeToWin({name: 'root'});">
                <span>返回</span>
            </a>
            <div id="jsmiddle">
                <strong id="jstitle">金额设置</strong>
            </div>
            <a id="jsright">
                <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
            </a>
        </nav>
    </div>
    </header>
    <div class="paddingtop70"></div>
    <div class="page__bd">
        <!-- <div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <label class="weui-label">金额</label>
                </div>
                <div class="weui-cell__bd">
                    <input id="in_je" class="weui-input" type="text" placeholder="请输入转账金额"></input>
                </div>
            </div>
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <label class="weui-label">附言</label>
                </div>
                <div class="weui-cell__bd">
                    <input class="weui-input" type="text" placeholder="选填（不超过10个字）"></input>
                </div>
            </div>
        </div> -->
        <br />
        <div class="page__bd page__bd_spacing">
   <!-- <input id="btn1" onclick="test()" type="button" name="yzmhq" style="color:#FFFFFF;border:none;width:100%;height:50px;background-color:#104E8B" value="扫描二维码" > -->
   <a class="weui-btn weui-btn_default" id="showIOSDialog1" onclick="tc()">收款</a>
        </div>
    </div>
    <div class="js_dialog" id="iosDialog1" style="opacity: 1;">
            <div class="weui-mask" id="zftc1" style="display:none;"></div>
              <div class="weui-dialog" id="zftc" style="display:none;">
                          <div class="weui-dialog__hd"><strong class="weui-dialog__title">收款金额</strong></div>

                          <div class="weui-cell">
                            <div class="weui-cell__hd"><label class="weui-label">金额</label></div>
                            <div class="weui-cell__bd">
                                <input class="weui-input" id="in_je" type="number" placeholder="请输入金额" pattern="[0-9]*">
                            </div>
                        </div>
                          <div class="weui-dialog__ft">
                              <a class="weui-dialog__btn weui-dialog__btn_default" onclick="api.closeToWin({name: 'root'});">取消</a>
                              <a class="weui-dialog__btn weui-dialog__btn_primary"  onclick="test()" >继续</a>
                          </div>
              </div>
  </div>
    <div id="loadingToast" style="display:none;">
  			<div class="weui-mask_transparent"></div>
  			<div class="weui-toast">
  				<i class="weui-loading weui-icon_toast"></i>
  				<p class="weui-toast__content">收款中...</p>
  			</div>
  		</div>
</body>
<script>
function tc(){
  $("#zftc1").show();
   $("#zftc").show();
}

    function test(){
      var je = $("#in_je").val();
      console.info(je);

       var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
       if (reg.test(je)) {
        cancelOrder(je);
    }else{
         alert("金额输入有误！");
    };
    }



    function cancelOrder(je) {
      console.info("1");
        api.confirm({
            title: '确认金额',
            msg: '是否继续？金额￥'+je+'元',
            buttons: [ '继续','取消']
        }, function(ret, err) {
            if (ret.buttonIndex == 1) {
                smtjfpxx();
            }
        });

    }

    function smtjfpxx(){

      var FNScanner = api.require('FNScanner');
    		FNScanner.openScanner({
    		    autorotation: true
    		}, function(ret, err) {
          if(ret.content!=undefined){
                  $("#loadingToast").show();
            var con = JSON.stringify(ret.content);
                  var je = $("#in_je").val();
                  qrno = con;
                  
                  var aeskey = api.loadSecureValue({
			        sync: true,
			        key: 'aeskey'
			      });
			      var salt = api.loadSecureValue({
				        sync: true,
				        key: 'salt'
				    });
				    
				    var phone = $api.getStorage("dl_phone");
				    var openid = $api.getStorage("openid");
				    var content = {"qr":con,"je":je,"phone":phone,"openid":openid};
			        var callback = function(ret, err){
				        //console.log(JSON.stringify(ret));
				         if(ret.flag=="Y"){
                                mytime = setInterval(function(){
                                var callback = function(ret, err){
							        //console.log(JSON.stringify(ret));
							         if(ret.flag=="Y"){
                                                  var lsh = ret.pd.LSH;
                                                  var rksj = ret.pd.RKSJ;
                                                  var je = ret.pd.JE;
                                                    console.info(rksj+je+lsh);
                                                    clearTimeout(mytime);
                                                      $("#loadingToast").hide();
                                                      api.openWin({
                                                          name: 'skts',
                                                          url: 'skts.html',
                                                          pageParam: {
                                                             lsh:lsh,
                                                             rksj:rksj,
                                                             je:je,
                                                          }
                                                      });
                                                      alert("收款成功！");
                                                }else if(ret.flag=="N"){
                                                  clearTimeout(mytime);
                                                    $("#loadingToast").hide();
                                                      alert("网络链接失败！");
                                                  console.log("服务请求错误,请联系管理员");
                                                }else{
                                                  console.log("暂未请求到数据");
                                                }
							    }
							    var content = {"qrno":con};
							    apiAjax(JSON.stringify(content),url.skzt,callback);
                              }, 2000)
                              }
				    }
				    encApiAjax(JSON.stringify(content),url.shsk,callback);
          }

          })
        }

</script>

</html>
